package com.xishu.client.sms;

import com.xishu.util.Tools;

import java.util.Arrays;

public class SmsFactory implements Tools {
    private static SmsFactory instance = new SmsFactory();

    private SmsFactory() {
    }

    public static SmsFactory getInstance() {
        return instance;
    }

    public IsmsClient createClient(String areaCode) {
        if (isBeijingPhone(areaCode)) {
            return YunPianClient.getInstance();
        } else {
            return AliyunSMSClient.getInstance();
        }
    }

    public boolean isBeijingPhone(String areaCode) {
        return Arrays.asList("86", "+86").contains(areaCode);
    }
}
